package com.universe.titan.module.crudDemo.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.universe.titan.common.entity.crudDemo.Demo;
import com.universe.titan.module.crudDemo.dao.DemoMapper;
import com.universe.titan.module.crudDemo.service.DemoService;
import com.universe.titan.module.crudDemo.vo.DemoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Author : linmaobo
 * @create 2022/12/6
 */
@Component
public class DemoServiceImpl extends ServiceImpl<DemoMapper, Demo> implements DemoService {

    @Autowired
    private DemoMapper demoMapper;


    @Override
    public List<Demo> getByName(String name) {
        return demoMapper.selectByName(name);
    }

    @Override
    public IPage<Demo> getPageByDemoVo(DemoVo demoVo) {
        Page page = new Page<>(demoVo.getPageNum(), demoVo.getPageSize());
        return demoMapper.selectPageByDemoVo(page, demoVo);
    }
}
